<?php

use app\assets\DateAsset;
use app\assets\MaskAsset;
use app\helpers\UserHelper;
use app\models\User;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\ActiveForm;

/* @var $model User */
/* @var $this View */
MaskAsset::register($this);
DateAsset::register($this);

$this->registerJs("$('#user-amf').mask('AA AA');");
$this->registerJs("$('#user-k, #user-op, #user-opc').mask('AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA');");
$this->registerJs("$('#user-sqn').mask('00 00 00 00 00 00');");

?>
<?php $form = ActiveForm::begin([
    'options' => ['class' => 'form-horizontal'],
    'fieldConfig' => [
        'template' => "{label}\n<div class=\"col-md-3\">{input}\n{error}</div>",
        'labelOptions' => ['class' => 'col-md-2 control-label']
    ]
]); ?>

<div class="panel">
    <div class="panel-heading">
        <div class="panel-header">
            <h4 class="panel-title">基本信息</h4>
        </div>
    </div>
    <div class="panel-body">
        <?= $form->field($model, 'imsi')->textInput([$model->isNewRecord ? '' : 'readonly' => 'readonly']); ?>
        <?= $form->field($model, 'phone')->textInput([$model->isNewRecord ? '' : 'readonly' => 'readonly']); ?>
        <?= $form->field($model, 'device_type')->dropDownList(UserHelper::$deviceType); ?>
        <?= $form->field($model, 'user_priority')->dropDownList(UserHelper::$userPriority); ?>
        <?= $form->field($model, 'esn')->textInput(); ?>
        <?= $form->field($model, 'vo_coder')->dropDownList(UserHelper::$voCoder); ?>
    </div>
</div>

<div class="panel">
    <div class="panel-heading">
        <div class="panel-header">
            <h4 class="panel-title">鉴权数据</h4>
        </div>
    </div>
    <div class="panel-body">
        <?= $form->field($model, 'amf')->textInput(); ?>
        <?= $form->field($model, 'sqn')->textInput(); ?>
        <?= $form->field($model, 'k', ['template' => "{label}\n<div class=\"col-md-5\">{input}\n{error}</div>"])->textInput(); ?>
        <?= $form->field($model, 'op', ['template' => "{label}\n<div class=\"col-md-5\">{input}\n{error}</div>"])->textInput(); ?>
        <?= $form->field($model, 'opc', ['template' => "{label}\n<div class=\"col-md-5\">{input}\n{error}</div>"])->textInput(); ?>

        <div class="form-group">
            <label class="col-md-2 control-label">TIME</label>
            <div class="col-md-10">
                <div class="row">
                    <div class="col-md-2">
                        <?= Html::activeTextInput($model, 'start', ['class' => 'form-control start', 'readonly' => 'readonly']); ?>
                    </div>
                    <div class="col-md-2">
                        <?= Html::activeTextInput($model, 'stop', ['class' => 'form-control start', 'readonly' => 'readonly']); ?>
                    </div>
                </div>

            </div>
        </div>

    </div>
</div>

<div class="panel">
    <div class="panel-heading">
        <div class="panel-header">
            <h4 class="panel-title">基本业务</h4>
        </div>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-3">
                <div class="page-header">
                    <h5>基本业务类型</h5>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_secrecy'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_group'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_sms'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_call_group'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_full_duplex'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_half_duplex'); ?>
                    </label>
                </div>
            </div>
            <div class="col-md-3">
                <div class="page-header">
                    <h5>基本补充业务</h5>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_more_call'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_call_waiting'); ?>
                    </label>
                </div>
            </div>
            <div class="col-md-3">
                <div class="page-header">
                    <h5>呼叫限制业务</h5>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_call_in'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_call_out'); ?>
                    </label>
                </div>
            </div>
            <div class="col-md-3 fwd">
                <div class="page-header">
                    <h5>呼叫前转业务</h5>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_fwd_no_answer'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_fwd_on_busy_num'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_fwd_unc'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeCheckbox($model, 'is_fwd_na_num'); ?>
                    </label>
                </div>
                <div class="checkbox">
                    <label>
                        <?= Html::activeTextInput($model, 'fwd_phone', ['class' => 'form-control']); ?>
                    </label>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="form-group">
    <div class="col-md-12">
        <?= Html::submitButton('提交', ['class' => 'btn btn-block ladda-button', 'data-style'=>'zoom-in']) ?>
    </div>
</div>

<?php ActiveForm::end(); ?>
